import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)


import Login from './views/Login.vue'
import NotFound from './views/404.vue'
import Home from './views/Home.vue'
import Main from './views/Main.vue'
import Dashboard from './views/dashboard/dashboard.vue'

//服务器管理
import Server from './views/server/assets.vue'
import Console from './views/server/console.vue'
import Mysql from './views/server/db.vue'
import Ansible from './views/server/ansible.vue'

import SqlJob from './views/server/db/job.vue'
import SqlSelect from './views/server/db/select.vue'
import SlowLog from './views/server/db/slowlog.vue'


//发布系统

import itemManager from './views/deployment/itemsmanager.vue'
import itemDetails from './views/deployment/itemmanager/detail'
import itemWorkspace from './views/deployment/itemmanager/workspace'
import itemOutput from './views/deployment/itemmanager/output'

import addView from './views/deployment/itemmanager/newview'
import editView from './views/deployment/itemmanager/editview'


import itemAdd from './views/deployment/itemmanager/new'
import itemConfig from './views/deployment/itemmanager/config'

import createJob from './views/deployment/createjob.vue'
import deploymentList from './views/deployment/joblist.vue'

import testvue from './views/deployment/testvue.vue'

//监控系统
import monitorServer from './views/monitor/servers.vue'
import monitorMysql from './views/monitor/mysql.vue'
import monitorInterface from './views/monitor/interface.vue'


//k8s

import Namespacce from './views/k8s/namespace.vue'
import Node from './views/k8s/node.vue'
import Role from './views/k8s/clusterrole.vue'
import PersistentVolumes from './views/k8s/persistentvolumes.vue'

import PersistentVolume from './views/k8s/persistentvolume.vue'
import persistentvolumeclaim from './views/k8s/persistentvolumeclaim.vue'

import NodeDetails from './views/k8s/nodedetail.vue'
import NamespaceDetails from './views/k8s/nsdedetail.vue'

import Daemonset from './views/k8s/daemonset.vue'
import DeploymentDetails from './views/k8s/deploymentdetail.vue'
import ReplicaSet from './views/k8s/replicasets.vue'
import Configmap from './views/k8s/configmap.vue'
import Secret from './views/k8s/secret.vue'
import Job from './views/k8s/job.vue'
import Statefulset from './views/k8s/statefulset.vue'
import Pod from './views/k8s/pod.vue'
import Logs from './views/k8s/logs.vue'


//系统管理
import OpsJob from './views/systemmanager/opsjob.vue'
import OpsUser from './views/systemmanager/users.vue'
import OpsConfig from './views/systemmanager/sysconfig.vue'



import echarts from './views/charts/echarts.vue'
import echarts1 from './views/charts/echarts.vue'
import echarts2 from './views/charts/echarts.vue'




// export const constantRouterMap = [
//     {
//         path: '/login',
//         component: Login,
//         name: '',
//         hidden: true
//     },
//     {
//         path: '/404',
//         component: NotFound,
//         name: '',
//         hidden: true
//     }
// ]


let routes = [
    {
        path: '/login',
        component: Login,
        name: '',
        hidden: true
    },
    // {
    //     path: '/404',
    //     component: NotFound,
    //     name: '',
    //     hidden: true
    // },
    //{ path: '/main', component: Main },


    // {
    //     path: '*',
    //     hidden: true,
    //     redirect: { path: '/404' }
    // }




];




export const opsRouters = [
    {
        path: '/',
        component: Home,
        name: '仪表盘',
        iconCls: 'fa fa-pie-chart',
        leaf: true,//只有一个节点
        children: [
            { path: '/dashboard', component: Dashboard, name: 'Dashboard' }
        ]
    },
    {
        path: '/ops',
        component: Home,
        name: 'CMDB',
        iconCls: 'fa fa-server',//图标样式class
        children: [
            { path: '/main', component: Main, name: '主页', hidden: true },
            { path: '/server', component: Server, name: '服务器' },
            { path: '/shell/:ipv4', component: Console, name: '控制台',hidden: true },  //HOME hidden leaf[1]
            { path: '/db', component: Mysql, name: 'SQL审核平台'},
            { path: '/db/update/:name',component: SqlJob,name: 'SQL任务清单',hidden: true},
            { path: '/db/select/:instance',component: SqlSelect,name: '数据查询',hidden: true},
            { path: '/db/slowlog/:instance',component: SlowLog,name: '慢日志报告',hidden: true},
            { path: '/ansible', component: Ansible, name: 'Ansible批量处理'},
        ]
    },
    {
        path: '/deploy',
        component: Home,
        name: '代码发布',
        iconCls: 'fa fa-automobile',
        children: [
            // { path: '/deplay/jenkins', component: jenkins, name: 'jenkins发布'},
            { path: '/deploy/items', component: itemManager, name: '项目管理' },
            { path: '/deploy/item/:name/detail', component: itemDetails, name: '项目详情',hidden: true },
            { path: '/deploy/item/:name/workspace', component: itemWorkspace, name: '工作空间',hidden: true },
            { path: '/deploy/item/:name/config', component: itemConfig, name: '项目配置',hidden: true },
            { path: '/deploy/item/:name/:id/output', component: itemOutput, name: '控制台输出',hidden: true },
            { path: '/deploy/view/add', component: addView, name: '新建视图',hidden: true },
            { path: '/deploy/view/:name/config', component: editView, name: '编辑视图',hidden: true },



            { path: '/deploy/item/add', component: itemAdd, name: '新增项目',hidden: true },

            { path: '/deploy/newjob', component: createJob, name: '创建部署' },
            { path: '/deploy/joblist', component: deploymentList, name: '部署清单' },

            { path: '/deploy/testvue', component: testvue, name: '测试页面' },

        ]
    },


    {
        path: '/monitor',
        component: Home,
        name: '监控平台',
        iconCls: 'fa fa-bar-chart',
        children: [
            { path: '/monitor/servers', component: monitorServer, name: '服务器监控' },

            { path: '/monitor/mysql', component: monitorMysql, name: '数据库监控' },
            // { path: '/echarts', component: echarts, name: 'redis监控' },
            { path: '/monitor/interface', component: monitorInterface, name: '接口监控' },
            { path: '/echarts', component: echarts, name: 'k8s集群监控' },
        ]
    },

    {
        path: '/logsys',
        component: Home,
        name: '日志系统',
        iconCls: 'fa fa-file-archive-o',
        children: [
            { path: '/echarts1', component: echarts1, name: '日志查询' },
            { path: '/echarts2', component: echarts2, name: '日志下载' }
        ]
    },
    {
        path: '/kubernetes',
        component: Home,
        name: 'kubernetes',
        iconCls: 'fa fa-desktop',
        children: [
            { path: '/kubernetes/namespaces', component: Namespacce, name: '命名空间' },
            { path: '/kubernetes/namespace/:name',component: NamespaceDetails,name: '空间详情',hidden: true},

            { path: '/kubernetes/daemonset/:name',component: Daemonset,name: '守护进程集',hidden: true},
            { path: '/kubernetes/deployment/:name',component: DeploymentDetails,name: '部署详情',hidden: true},
            { path: '/kubernetes/replicaset/:name',component: ReplicaSet,name: '副本集',hidden: true},
            { path: '/kubernetes/configmap/:name',component: Configmap,name: '配置集',hidden: true},
            { path: '/kubernetes/secret/:name',component: Secret,name: '保密字典',hidden: true},
            { path: '/kubernetes/jobs/:name',component: Job,name: '容器信息',hidden: true},
            // { path: '/kubernetes/statefulset/:name',component: Statefulset,name: '容器信息',hidden: true},
            // { path: '/kubernetes/pods/:name',component: Pod,name: '容器信息',hidden: true},
            { path: '/kubernetes/logs/:name',component: Logs,name: 'POD日志',hidden: true},


            { path: '/kubernetes/nodes', component: Node, name: '节点' },
            { path: '/kubernetes/node/:name',component: NodeDetails,name: '节点详情',hidden: true},
            { path: '/kubernetes/persistentvolumes', component: PersistentVolumes, name: '持久化存储' },
            // { path: '/kubernetes/persistentvolume/:name',component: PersistentVolume,name: '持久化存储',hidden: true},
            { path: '/kubernetes/persistentvolumeclaim/:name',component: persistentvolumeclaim,name: '持久化存储索取',hidden: true},
            { path: '/kubernetes/role', component: Role, name: '集群角色' },
        ]
    },
    {
        path: '/opsmanager',
        component: Home,
        name: '运维管理',
        iconCls: 'fa fa-address-card',
        //leaf: true,//只有一个节点
        children: [
            //{ path: '/page6', component: Page6, name: '服务器管理' },
            { path: '/opsmanager/job', component: OpsJob, name: '任务管理' },
            { path: '/opsmanager/user', component: OpsUser, name: '用户管理' },
            { path: '/opsmanager/config', component: OpsConfig, name: '系统设置' },
            // { path: '/shell/:ipv4', component: Console, name: '控制台',hidden: true }  //HOME hidden leaf[1]
        ]
    },
    {
        path: '*',
        hidden: true,
        redirect: { path: '/404' }
    },
    //权限测试

]
export const developerRouters = [
    {
        path: '/',
        component: Home,
        name: '',
        iconCls: 'fa fa-pie-chart',
        leaf: true,//只有一个节点
        children: [
            { path: '/dashboard', component: Dashboard, name: 'Dashboard' }
        ]
    },
    {
        path: '/ops',
        component: Home,
        name: '服务器管理',
        iconCls: 'fa fa-server',//图标样式class
        children: [

            { path: '/db', component: Mysql, name: 'SQL任务平台'},
            { path: '/db/update/:name',component: SqlJob,name: 'Mysql操作 / 任务清单',hidden: true},
            { path: '/db/select/:instance',component: SqlSelect,name: '查询',hidden: true},
            { path: '/db/slowlog/:instance',component: SlowLog,name: '慢日志报告',hidden: true},

        ]
    },

    {
        path: '/deploy',
        component: Home,
        name: '代码发布',
        iconCls: 'fa fa-automobile',
        children: [
            // { path: '/deplay/jenkins', component: jenkins, name: 'jenkins发布'},
            { path: '/deploy/items', component: itemManager, name: '项目管理' },
            { path: '/deploy/item/:name/detail', component: itemDetails, name: '项目详情',hidden: true },
            { path: '/deploy/item/:name/workspace', component: itemWorkspace, name: '工作空间',hidden: true },
            { path: '/deploy/item/:name/config', component: itemConfig, name: '项目配置',hidden: true },
            { path: '/deploy/item/:name/:id/output', component: itemOutput, name: '控制台输出',hidden: true },
            { path: '/deploy/view/add', component: addView, name: '新建视图',hidden: true },
            { path: '/deploy/view/:name/config', component: editView, name: '编辑视图',hidden: true },



            { path: '/deploy/item/add', component: itemAdd, name: '新增项目',hidden: true },

            { path: '/deploy/newjob', component: createJob, name: '创建部署' },
            { path: '/deploy/joblist', component: deploymentList, name: '部署清单' },

            { path: '/deploy/testvue', component: testvue, name: '测试页面' },

        ]
    },


    {
        path: '/monitor',
        component: Home,
        name: '监控平台',
        iconCls: 'fa fa-bar-chart',
        children: [
            { path: '/monitor/servers', component: monitorServer, name: '服务器监控' },

            { path: '/monitor/mysql', component: monitorMysql, name: '数据库监控' },
            // { path: '/echarts', component: echarts, name: 'redis监控' },
            { path: '/monitor/interface', component: monitorInterface, name: '接口监控' },
            { path: '/echarts', component: echarts, name: 'k8s集群监控' },
        ]
    },

    {
        path: '/logsys',
        component: Home,
        name: '日志系统',
        iconCls: 'fa fa-file-archive-o',
        children: [
            { path: '/echarts1', component: echarts1, name: '日志查询' },
            { path: '/echarts2', component: echarts2, name: '日志下载' }
        ]
    },
    {
        path: '*',
        hidden: true,
        redirect: { path: '/404' }
    },
    //权限测试

]
export const testerRouters = [
    {
        path: '/',
        component: Home,
        name: '',
        iconCls: 'fa fa-pie-chart',
        leaf: true,//只有一个节点
        children: [
            { path: '/dashboard', component: Dashboard, name: 'Dashboard' }
        ]
    },
    {
        path: '/ops',
        component: Home,
        name: '服务器管理',
        iconCls: 'fa fa-server',//图标样式class
        children: [

            { path: '/db', component: Mysql, name: 'SQL任务平台'},
            { path: '/db/update/:name',component: SqlJob,name: 'Mysql操作 / 任务清单',hidden: true},
            { path: '/db/select/:instance',component: SqlSelect,name: '查询',hidden: true},
            { path: '/db/slowlog/:instance',component: SlowLog,name: '慢日志报告',hidden: true},

        ]
    },

    {
        path: '/deploy',
        component: Home,
        name: '代码发布',
        iconCls: 'fa fa-automobile',
        children: [
            // { path: '/deplay/jenkins', component: jenkins, name: 'jenkins发布'},
            { path: '/deploy/items', component: itemManager, name: '项目管理' },
            { path: '/deploy/item/:name/detail', component: itemDetails, name: '项目详情',hidden: true },
            { path: '/deploy/item/:name/workspace', component: itemWorkspace, name: '工作空间',hidden: true },
            { path: '/deploy/item/:name/config', component: itemConfig, name: '项目配置',hidden: true },
            { path: '/deploy/item/:name/:id/output', component: itemOutput, name: '控制台输出',hidden: true },
            { path: '/deploy/view/add', component: addView, name: '新建视图',hidden: true },
            { path: '/deploy/view/:name/config', component: editView, name: '编辑视图',hidden: true },



            { path: '/deploy/item/add', component: itemAdd, name: '新增项目',hidden: true },

            { path: '/deploy/newjob', component: createJob, name: '创建部署' },
            { path: '/deploy/joblist', component: deploymentList, name: '部署清单' },

            { path: '/deploy/testvue', component: testvue, name: '测试页面' },

        ]
    },


    {
        path: '/monitor',
        component: Home,
        name: '监控平台',
        iconCls: 'fa fa-bar-chart',
        children: [
            { path: '/monitor/servers', component: monitorServer, name: '服务器监控' },

            { path: '/monitor/mysql', component: monitorMysql, name: '数据库监控' },
            // { path: '/echarts', component: echarts, name: 'redis监控' },
            { path: '/monitor/interface', component: monitorInterface, name: '接口监控' },
            { path: '/echarts', component: echarts, name: 'k8s集群监控' },
        ]
    },

    {
        path: '/logsys',
        component: Home,
        name: '日志系统',
        iconCls: 'fa fa-file-archive-o',
        children: [
            { path: '/echarts1', component: echarts1, name: '日志查询' },
            { path: '/echarts2', component: echarts2, name: '日志下载' }
        ]
    },
    {
        path: '*',
        hidden: true,
        redirect: { path: '/404' }
    },
    //权限测试

]


// export default routes;
export default new Router({
    // mode: 'history', //后端支持可开
    // scrollBehavior: () => ({ y: 0 }),
    routes: routes
})